
package com.example.cia.database.support;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import net.sf.json.JSONObject;

public class JSONStringHandler {
	
	/**
	 * 提供json字符串的解析
	 */

	private JSONObject jsonObject ;
	private String result;
	private Map<String,String> mutipleResult;
	
	public String jsonObjectToString(JSONObject json){
		result = json.toString();
		return result;
	}
	
	public Map<String,String>  jsonObjectToMap(JSONObject json){
		//获取keys
		List<String> keyList = new ArrayList<String>();
		Iterator keyIterator = json.keys();
		for(;keyIterator.hasNext();){
			String key = keyIterator.next().toString();
			mutipleResult.put(key, json.getString(key));
		}
		return mutipleResult;
	}
	
	
}
